<template>
	<view>
		<image :src="src" :mode="mode" :style="{'width': width + 'rpx',height: height+'rpx'}"
			@click.stop="handler('tapImg')">
		</image>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: ''
			}
		},
		props: {
			src: {
				type: String,
				default: ''
			},
			width: {
				type: [String, Number],
				default: 100
			},
			height: {
				type: [String, Number],
				default: 100
			},
			mode: {
				type: String,
				default: 'aspectFit'
			}
		},
		onLoad() {
			if (this.src.match(/^http/)) {
				this.url = this.src
			} else {
				this.url = this.DO_NAME + this.src
			}
		},
		methods: {
			handler(event) {
				this.$emit(event)
			},
			previewImg() {
				uni.previewImage({
					urls: [this.src]
				})
			},
		}
	}
</script>

<style>
</style>
